﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Configuration;
using System.Web;

namespace X.Web
{
    public class AdminPage : PageBase
    {
        //private static CheckPermissionsElement checkPermissionsElement;
        //private const string CustomConfigurationSection = "XWeb/Security";

        public AdminPage()
        {
            base.Refreshed += new EventHandler(AdminPage_Refreshed);
            //InitializeConfigElement();
        }

        void AdminPage_Refreshed(object sender, EventArgs e)
        {
            throw new Exception();
        }

        /*private static void InitializeConfigElement()
        {
            if (null == checkPermissionsElement)
            {
                SecuritySection section = WebConfigurationManager.GetSection("XWeb/Security") as SecuritySection;

                if (null != section)
                    checkPermissionsElement = section.CheckPermissions;
            }
        }*/
        /*public void CheckPagePermission()
        {
            bool flag = false;
            string str = base.Request.AppRelativeCurrentExecutionFilePath.ToLower().Replace("~/admin/", string.Empty);
            PermissionPageElement elemet = checkPermissionsElement.Page[str];
            if (null == elemet)
            {
                if (checkPermissionsElement.Mode != NoCheckType.All)
                    flag = true;
            }
            else
            {
                string operateCode = elemet.OperateCode;
                if (string.Compare(operateCode, "Node", StringComparison.CurrentCultureIgnoreCase) == 0)
                    flag = true;
            }
            if (!flag)
                throw new Exception("您没有当前页面的访问权限!");
        }*/

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            //SetViewStateUserKey();
            //CheckPagePermission();
        }

        /*private void SetViewStateUserKey()
        {
            if (null != HttpContext.Current.Session)
                base.ViewStateUserKey = Session.SessionID;
        }*/
    }
}
